package com.study.subpub;

/**
 * @Author HBZ
 * @Date 2020/7/21 15:51
 * @Description 订阅者实现类
 */
public class SubcriberImpOne <M> implements ISubcriber<M>{
    public String name;
    public SubcriberImpOne(String name) {
        super();
        this.name = name;
    }
    @Override
    public void subcribe(SubscribePublish subscribePublish) {
        subscribePublish.subcribe(this);
    }
    @Override
    public void unSubcribe(SubscribePublish subscribePublish) {
        subscribePublish.unSubcribe(this);
    }
    @Override
    public void update(String publisher, M message) {
        System.out.println(this.name+"收到"+publisher+"发来的消息:"+message.toString());
    }
}
